<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>实验4 函数</title>
</head>
<body>
   <!-- <script>
       var Cat ={};
       Cat.name="kity";
       Cat.age=2;
       Cat.sayHello=function(){
           alert("hello"+ Cat.name+",今年"+Cat["age"]+"岁了");
       }
       Cat.sayHello ();
   </script> -->
<!-- <script>
    var Panda ={};
    Panda.name="托比";
   Panda.age=3;
        Panda.sayHello=function(){
        alert("hello"+ Panda.name+",今年"+Panda["age"]+"岁了");
    }
    Panda.sayHello ();
</script> -->
        <!-- <script>
            function Person(){
        
            }
            var PersonOne=new Person();
            PersonOne.name="Kenan";
            PersonOne.hobby="coding";
            PersonOne.work=function(){
                alert(PersonOne.name+"is coding now...")
            }
            PersonOne.work();
        </script> -->
        <script>
            function  Pet(name,age,hobby){
                this.name=name;
                this.age=age;
                this.hobby=hobby;
                this.eat=function(){
                    alert("我叫"+this.name+",我喜欢"+this.age+"岁了"+",我喜欢"+this.hobby)
                
                }
            }
            var maidou=new Pet("麦兜",5,"睡觉");
            maidou.eat()
            var pubasen=new Pet("普巴森",3,"唱歌");
            pubasen.eat()
            var xielaoban=new Pet("蟹老板",35,"工作");
             xielaoban.eat()
        </script>
            

        //     function  Carton(name,age,hobby){
        //         this.name=name;
        //         this.age=age;
        //         this.hobby=hobby;
        //         this.hhh=function(){
        //             alert("我叫"+this.name+",我喜欢"+this.hobby+",也是一个美男子")
        //         }
        //     }
        //     var pubasen=new Carton("普巴森",2,"唱歌");
        //    pubasen.hhh()

        //    function  Carton(name,age,hobby){
        //         this.name=name;
        //         this.age=age;
        //         this.hobby=hobby;
        //         this.zzz=function(){
        //             alert("我叫"+this.name+",我喜欢"+this.hobby+",也是一个成功人士")
        //         }
        //     }
        //     var xielaoban=new Carton("蟹老板",30,"工作");
        //    xielaoban.zzz()
        </script>
</body>
</html>